package WaiBao;

import java.util.Arrays;

public class KongXiangRui {
    public static void main(String[] args) {
        String[] name = {"王一博(班长)", "李二牛(副班长)", "小李(学习委员)", "李大虎(纪律委员)", "王小胖(体育委员)", "王境泽", "郑凯", "陈赫", "邓超", "李晨", "杨颖", "爱贝拉",
                "李存勖", "李星云", "廉颇", "典韦", "李虎", "王帅", "吕子乔", "大张伟", "华晨宇", "闫妮", "黄子韬", "张艺兴", "李泽楷", "欧豪辰", "权志龙", "黄家驹",
                "李荣浩", "孔祥睿(学生)"};//最后一位考生本人: 孔祥睿  210710011311
        int[] age = {18, 19, 20, 21, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁

        double[] pangdun1 = {84, 84, 95, 84, 91, 84, 74, 79, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[] pangdun2 = {75, 93, 75, 74, 96, 81, 71, 84, 94, 87, 90, 77, 76, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[] pangdun3 = {79, 84, 93, 91, 74, 69, 76, 77, 89, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 94};

        double chengzi;//代表每个学生的总分
        double apple;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            chengzi = pangdun1[i] +pangdun2[i] + pangdun3[i];
//            apple  = ( chengzi* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +  chengzi);
//            System.out.println(name[i] + "的平均分为:" +  apple);
//        }


        double caomei = 0, digua = 0;
        double[] heizi = new double[30];
//        for (int i = 0; i < 30; i++) {
//            caomei = pangdun1[i] +  pangdun2[i] + pangdun3[i];
//            digua  = (caomei * 1.0) / 3;
//            heizi[i] = digua ;
//        }
//
//        for (int i = 0; i <heizi.length - 1; i++) {
//            for (int j = 0; j < heizi.length - i - 1; j++) {
//                if (heizi[j] < heizi[j + 1]) {
//                    double tep =heizi[j];
//                    heizi[j] =heizi[j + 1];
//                    heizi[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(heizi[i]);
//        }


        double kuka1 = 0, kuka2 = 0, kuka3 = 0;//计算每门课的平均分
        double beizi1 = 0,beizi2 = 0 ,beizi3 = 0;//计算每门课标准差
        double demo1 = 0,demo2 = 0,demo3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < pangdun1.length; i++) {
            sum2+=pangdun1[i];
        }
        kuka1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+kuka1);
        double Sum = 0;
        for (int i = 0; i < pangdun2.length; i++) {
            Sum+=pangdun2[i];
        }
        kuka2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+kuka2);
        double sum = 0;
        for (int i = 0; i <pangdun3.length; i++) {
            sum+=pangdun3[i];
        }
        kuka3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ kuka3);


        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <pangdun1.length; i++) {
            c1+= (pangdun1[i] - kuka1)*(pangdun1[i] - kuka1);
        }
        beizi1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+ beizi1);

        for (int i = 0; i <pangdun2.length; i++) {
            c2+= (pangdun2[i] - kuka2)*(pangdun2[i] -kuka2);
        }
        beizi2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+ beizi2);

        for (int i = 0; i < pangdun3.length; i++) {
            c3+= (pangdun3[i] -kuka3)*(pangdun3[i] - kuka3);
        }
        beizi3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+ beizi3);

//
/*
        Arrays.sort(pangdun1);
        Arrays.sort(pangdun2);
        Arrays.sort(pangdun3);
        demo1 =(pangdun1[14]+pangdun1[15])*1.0/2;
        demo2 =(pangdun2[14]+pangdun2[15])*1.0/2;
        demo3 =(pangdun3[14]+pangdun3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+demo1);
        System.out.println("微生物学的中位数为:"+demo2);
        System.out.println("人体组织解剖学的中位数为:"+demo3);
*/


    }

}
